package com.usian.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.usian.mapper.UserMapper;
import com.usian.pojo.User;
import com.usian.service.UserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    //显示全部及分页
    @Override
    public PageInfo<User> findAll(Integer pageNum,Integer pageSize) {
        User user = new User();
        QueryWrapper<User> queryWrapper=new QueryWrapper<>();
        //查询条件 分类名查询  用户性别查询 用户年龄查询

//        Page page =new Page(user.getPageNum(),user.getPageSize());
//        IPage iPage=page(page,queryWrapper);
        PageHelper.startPage(pageNum,pageSize);
        List<User> userList = userMapper.findAll();
        PageInfo<User> pageInfo = new PageInfo<>(userList);
        return pageInfo;
    }

}
